package com.hyg.lib_music.modle;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * @author: Administrator
 * @date: 2021/4/25
 */
public class CategoryMusicThreeData {


    /**
     * code : 200
     * message : 获取乐库三级分类列表成功
     * data : [{"id":69,"cateName":"抑郁情绪","logoUrl":"https://music-catetory-icon.oss-cn-zhangjiakou.aliyuncs.com/%E6%8A%91%E9%83%81%E7%97%87.png","musicList":[{"id":1867,"musicName":"春郊试马","musician":"无","musicDuration":200,"region":0,"musicUrl":"https://app-music-library.oss-cn-beijing.aliyuncs.com/西医类/心理类/抑郁症/春郊试马.mp3","cateId":0,"favorite":0}]}]
     */

    public int code;
    public String message;
    public List<DataDTO> data;

    public static class DataDTO implements Parcelable{
        /**
         * id : 69
         * cateName : 抑郁情绪
         * logoUrl : https://music-catetory-icon.oss-cn-zhangjiakou.aliyuncs.com/%E6%8A%91%E9%83%81%E7%97%87.png
         * musicList : [{"id":1867,"musicName":"春郊试马","musician":"无","musicDuration":200,"region":0,"musicUrl":"https://app-music-library.oss-cn-beijing.aliyuncs.com/西医类/心理类/抑郁症/春郊试马.mp3","cateId":0,"favorite":0}]
         */

        public int id;
        public String cateName;
        public String logoUrl;
        public List<MusicListDTO> musicList;

        public DataDTO() {
        }

        public static class MusicListDTO implements Parcelable {
            public MusicListDTO() {
            }

            /**
             * id : 1867
             * musicName : 春郊试马
             * musician : 无
             * musicDuration : 200
             * region : 0
             * musicUrl : https://app-music-library.oss-cn-beijing.aliyuncs.com/西医类/心理类/抑郁症/春郊试马.mp3
             * cateId : 0
             * favorite : 0
             */


            public int id;
            public String musicName;
            public String musician;
            public int musicDuration;
            public int region;
            public String musicUrl;
            public int cateId;
            public int favorite;

            protected MusicListDTO(Parcel in) {
                id = in.readInt();
                musicName = in.readString();
                musician = in.readString();
                musicDuration = in.readInt();
                region = in.readInt();
                musicUrl = in.readString();
                cateId = in.readInt();
                favorite = in.readInt();
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeInt(id);
                dest.writeString(musicName);
                dest.writeString(musician);
                dest.writeInt(musicDuration);
                dest.writeInt(region);
                dest.writeString(musicUrl);
                dest.writeInt(cateId);
                dest.writeInt(favorite);
            }

            @Override
            public int describeContents() {
                return 0;
            }

            public static final Creator<MusicListDTO> CREATOR = new Creator<MusicListDTO>() {
                @Override
                public MusicListDTO createFromParcel(Parcel in) {
                    return new MusicListDTO(in);
                }

                @Override
                public MusicListDTO[] newArray(int size) {
                    return new MusicListDTO[size];
                }
            };
        }

        protected DataDTO(Parcel in) {
            id = in.readInt();
            cateName = in.readString();
            logoUrl = in.readString();
            musicList = in.createTypedArrayList(MusicListDTO.CREATOR);
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(id);
            dest.writeString(cateName);
            dest.writeString(logoUrl);
            dest.writeTypedList(musicList);
        }

        @Override
        public int describeContents() {
            return 0;
        }

        public static final Creator<DataDTO> CREATOR = new Creator<DataDTO>() {
            @Override
            public DataDTO createFromParcel(Parcel in) {
                return new DataDTO(in);
            }

            @Override
            public DataDTO[] newArray(int size) {
                return new DataDTO[size];
            }
        };
    }
}
